/**
 * 将下列代码使用promise改写
 * setTimeout(() => {
  var a = "hello";
  setTimeout(() => {
    var b = "lagou";
    setTimeout(() => {
      var c = "I ❤️ U";

      console.log(a + b + c);
    }, 10);
  }, 10);
}, 10);
 */

new myReslove("hello", 10)
  .then(value => {
    const b = "lagou";
    return myReslove(value + b, 10);
  })
  .then(value => {
    const c = "I ❤️ U";
    return myReslove(value + c, 10);
  })
  .then(value => console.log(value));

/**
 *
 * @param {string} value
 * @param {number} timeout
 */
function myReslove(value, timeout) {
  return new Promise(reslove => {
    setTimeout(() => {
      reslove(value);
    }, timeout);
  });
}
